package com.chilly.io;

import org.junit.jupiter.api.Test;

import java.io.*;

/**
 * 字符缓冲流
 * <p>
 * Created by Chilly Cui on 2020/9/24.
 */
public class BufferedCharDemo {

    @Test
    void test1() throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("c:/env/三国/赵云.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("c:/env/三国/赵子龙.txt"));
        String line = null;

        while ((line = br.readLine()) != null) {
            System.out.println(line);
            bw.write(line);
            bw.newLine();
        }
        br.close();
        bw.close();
    }
}
